




//
//  FMTableview.m
//  FM
//
//  Created by MB__Lee on 2018/4/9.
//  Copyright © 2018年 MB__Lee. All rights reserved.
//

#import "FMTableview.h"

#import "FBCell.h"

#import "FBCell.h"

#define  CELL_HEIGHT 40

@interface FMTableview()<UITableViewDelegate,UITableViewDataSource>



@end

static NSString *FBCellIdenti = @"FBCell";
@implementation FMTableview

-(instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
    if (self = [super initWithFrame:frame style:UITableViewStylePlain]) {
        
        
        self.delegate = self;
        self.dataSource = self;
        
        
    
        
        [self registerClass:[FBCell class] forCellReuseIdentifier:FBCellIdenti];
    }
    return  self;
}
-(void)setMutData:(NSArray<OutModel *> *)mutData{
    _mutData = mutData;
    [self reloadData];
}


#pragma mark --tableview代理方法
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return  self.mutData.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    FBCell *cell = [tableView dequeueReusableCellWithIdentifier:FBCellIdenti];
    
    cell.model = self.mutData[indexPath.row];
    
    return  cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return  [self.mutData[indexPath.section] cellHeight];
}










@end
